





import time
def consumer(name):
    print("%s 准备吃月饼了！" %name)
    while True:
        yuebing = yield
        print('月饼[%s]来了，被[%s]吃了！'%(yuebing,name))
c = consumer("yangmou")
'''c.__next__()
b1 = "水果鲜"
c.send(b1)
c.__next__()
b2 = '花生馅'
c.send(b2)'''
def producer(name):
    c = consumer('A')
    c2 = consumer('B')
    c.__next__()
    c2.__next__()
    print('爷准备做月饼了！')
    for i in range(10):
        time.sleep(2)
        print('做了两个月饼，一人一个')
        c.send(i)
        c2.send(i)

producer('haha')